package cc.eddic.practice.spring.dto;

import cc.eddic.practice.spring.domain.Option;
import cc.eddic.practice.spring.domain.SubCategory;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.val;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class OptionResponse {
    private  Long id;
    private char choice;
    private String answer;
    private boolean isCorrect;
    private Long questionId;

    public static OptionResponse from(final Option option){
        val dto=new OptionResponse();
        BeanUtils.copyProperties(option,dto);
        dto.questionId=option.getQuestion().getId();
        return dto;
    }
}
